<?php
/**
 * Created by PhpStorm.
 * User: wodrow
 * Date: 18-3-19
 * Time: 下午6:51
 */

namespace common\components\gps;


use common\components\tools\Tools;

class Haode extends Jimi
{
    const PRE_SIGN = '180';
    const NAME = 'haode';
    const NOTE = '昊德'; // http://www.hdvps.cn/index.jsp

    public function setConfig()
    {
        $this->config = [
            'app_key' => Config::$haode['key'],
            'app_secret' => Config::$haode['secret'],
            'user_id' => Config::$haode['admin_user'],
            'password' => Config::$haode['password'],
            'url' => Config::$haode['url'],
        ];
    }

    public function beforeAddGps()
    {
        $_data = unserialize($this->order->data);
        $_data['client_name'] = str_replace('业务', '', $_data['client_name']);
        $this->order->data = serialize($_data);
    }

    public function setPassword($password = '888888')
    {
        return md5($password);
    }
}